package lesson12;

import lesson05.A;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;

public class Test03 {
    public static void main(String[] args) {
       // 排序
        ArrayList list = new ArrayList();

        list.add(new Student("张飞",30,"男"));
        list.add(new Student("关羽",25,"男"));
        list.add(new Student("刘备",27,"男"));
        list.add(new Student("曹操",24,"男"));
        list.add(new Student("夏侯惇",31,"男"));

        Collections.sort(list,new MyComparator());

        for(Object obj : list){
            Student s = (Student) obj;
            System.out.println(s.getName() +" " + s.getAge());
        }


    }
}
